package com.ftg.learn.smhtml.mapper;

import org.apache.ibatis.jdbc.SQL;

public class DeptSql {

	public String getCountSql(String id) {
		
		return new SQL() {{
			SELECT("* ");
			FROM("product");
			if(null != id && !"".equals(id)) {
				WHERE("pid like concat(#{id},'%') ");
			}
		}}.toString(); 
	}
	
	
	public String getShowAllSql(String id,int begin,int end) {
		
		return new SQL() {{
			SELECT("*");
			FROM("product");
			if(null != id && !"".equals(id)) {
				WHERE("pid like concat(#{id},'%')");
			}
			
		}}.toString() + " limit #{begin},#{end}";
	}
	
}
